package com.tw.udf;

import java.io.IOException;

import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;

public class UrlRangeUdf extends EvalFunc<String>{
	@Override
	public String exec(Tuple input) throws IOException {
		if (input == null || input.size() == 0)
			return null;
		Long urlpv = (Long)input.get(0);
		if(urlpv==1L){
			return "1";
		}else if(urlpv==2L){
			return "2";
		}else if(urlpv==3L){
			return "3";
		}else if(urlpv==4L){
			return "4";
		}else if(urlpv>=5L&&urlpv<10L){
			return ">=5,<10";
		}else{
			return ">=10";
		}
	}
	
}
